/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.ucb.ProjetoFinal.domain;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

/**
 *
 * @author DCBorges
 */
@Entity
@Table(name = "sdctb024_unidfed")
public class UnidadeFederativa implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 2)
    @Column(name = "SG_UF")
    private String sgUf;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 20)
    @Column(name = "NO_UF")
    private String noUf;
    @OneToMany(mappedBy = "sgUf")
    private List<Municipio> municipioList;
    @OneToMany(mappedBy = "sgUf")
    private List<Prefeitura> prefeituraList;
    @OneToMany(mappedBy = "sgUf")
    private List<ParticipanteGrupo> participanteGrupoList;

    public UnidadeFederativa() {
    }

    public UnidadeFederativa(String sgUf) {
        this.sgUf = sgUf;
    }

    public UnidadeFederativa(String sgUf, String noUf) {
        this.sgUf = sgUf;
        this.noUf = noUf;
    }

    public String getSgUf() {
        return sgUf;
    }

    public void setSgUf(String sgUf) {
        this.sgUf = sgUf;
    }

    public String getNoUf() {
        return noUf;
    }

    public void setNoUf(String noUf) {
        this.noUf = noUf;
    }

    public List<Municipio> getMunicipioList() {
        return municipioList;
    }

    public void setMunicipioList(List<Municipio> municipioList) {
        this.municipioList = municipioList;
    }

    public List<Prefeitura> getPrefeituraList() {
        return prefeituraList;
    }

    public void setPrefeituraList(List<Prefeitura> prefeituraList) {
        this.prefeituraList = prefeituraList;
    }

    public List<ParticipanteGrupo> getParticipanteGrupoList() {
        return participanteGrupoList;
    }

    public void setParticipanteGrupoList(List<ParticipanteGrupo> participanteGrupoList) {
        this.participanteGrupoList = participanteGrupoList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (sgUf != null ? sgUf.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof UnidadeFederativa)) {
            return false;
        }
        UnidadeFederativa other = (UnidadeFederativa) object;
        if ((this.sgUf == null && other.sgUf != null) || (this.sgUf != null && !this.sgUf.equals(other.sgUf))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "br.ucb.ProjetoFinal.domain.UnidadeFederativa[ sgUf=" + sgUf + " ]";
    }
    
}
